import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { SecurityEventType, SecurityLevel } from '../entities/security-log.entity';

export class SecurityLogResponseDto {
  @ApiProperty({
    description: '安全日志ID',
  })
  id: string;

  @ApiProperty({
    description: '安全事件类型',
    enum: SecurityEventType,
  })
  eventType: SecurityEventType;

  @ApiProperty({
    description: '安全级别',
    enum: SecurityLevel,
  })
  securityLevel: SecurityLevel;

  @ApiProperty({
    description: '事件标题',
  })
  eventTitle: string;

  @ApiProperty({
    description: '事件详细描述',
  })
  eventDescription: string;

  @ApiPropertyOptional({
    description: '用户ID（如果涉及用户）',
  })
  userId?: string;

  @ApiPropertyOptional({
    description: '用户名（如果涉及用户）',
  })
  username?: string;

  @ApiPropertyOptional({
    description: 'IP地址',
  })
  ipAddress?: string;

  @ApiPropertyOptional({
    description: '用户代理',
  })
  userAgent?: string;

  @ApiPropertyOptional({
    description: '请求URL',
  })
  requestUrl?: string;

  @ApiPropertyOptional({
    description: '请求方法',
  })
  requestMethod?: string;

  @ApiPropertyOptional({
    description: '接口名称',
  })
  apiName?: string;

  @ApiPropertyOptional({
    description: '请求头信息',
  })
  requestHeaders?: any;

  @ApiPropertyOptional({
    description: '请求体信息',
  })
  requestBody?: any;

  @ApiPropertyOptional({
    description: '请求参数',
  })
  requestParams?: any;

  @ApiPropertyOptional({
    description: '错误代码',
  })
  errorCode?: string;

  @ApiPropertyOptional({
    description: '错误信息',
  })
  errorMessage?: string;

  @ApiPropertyOptional({
    description: '堆栈跟踪',
  })
  stackTrace?: string;

  @ApiPropertyOptional({
    description: 'HTTP状态码',
  })
  httpStatusCode?: number;

  @ApiPropertyOptional({
    description: '响应数据',
  })
  responseData?: any;

  @ApiPropertyOptional({
    description: '执行时间(ms)',
  })
  executionTime?: number;

  @ApiPropertyOptional({
    description: '会话ID',
  })
  sessionId?: string;

  @ApiPropertyOptional({
    description: '来源页面',
  })
  referer?: string;

  @ApiPropertyOptional({
    description: '国家/地区',
  })
  country?: string;

  @ApiPropertyOptional({
    description: '城市',
  })
  city?: string;

  @ApiProperty({
    description: '是否已处理',
  })
  isHandled: boolean;

  @ApiPropertyOptional({
    description: '处理时间',
  })
  handledAt?: Date;

  @ApiPropertyOptional({
    description: '处理人ID',
  })
  handledBy?: string;

  @ApiPropertyOptional({
    description: '处理备注',
  })
  handledNote?: string;

  @ApiProperty({
    description: '创建时间',
  })
  createdAt: Date;

  @ApiProperty({
    description: '更新时间',
  })
  updatedAt: Date;
}
